import {createBrowserRouter} from 'react-router-dom'
import App from '../App'
import {  lazy } from 'react'
const Home =()=>lazy(()=>import('../pages/home/Index'))
const Data=()=>lazy(()=>import('../pages/data/Index'))
const Data1=()=>lazy(()=>import('../pages/data1/Index'))
const My=()=>lazy(()=>import('../pages/my/Index'))
const Todo=()=>lazy(()=>import('../pages/todo/Index'))

type routersType={
    path:string,
    element:JSX.Element,
    children?:{path:string,element:JSX.Element}[]
}[]

const routes:routersType=[
    {
        path:'/',
        element:<App/>,
        children:[
            {
                path:'data',
                element:<Data/>
            },
            {
                path:'data1',
                element:<Data1/>,
            },
            {
                path:'home',
                element:<Home/>,
            },
            {
                path:'Todo',
                element:<Todo/>,
            },
            {
                path:'my',
                element:<My/>,
            },
        ]
    }
]
const router =createBrowserRouter(routes)
export default router;